import java.util.concurrent.atomic.AtomicInteger;

public class Test {
    class AtomicInteger{
        private int value;

        public int getAndIncrement() {
            int oldValue = value;
            while ( CAS(value,oldValue,oldValue+1) != true){
                oldValue = value;
            }
            return oldValue;
        }
    }
    public static void main(String[] args) {
        //AtomicInteger atomicInteger = new AtomicInteger();

        //atomicInteger.getAndIncrement();//相当于 i++
    }
}
